<template>
  <div>
    <!-- 表单区域 -->
    <el-form :inline="true" :model="form" class="demo-form-inline">
      <el-form-item label="姓名">
        <el-input v-model="form.user" placeholder="请输入员工姓名"></el-input>
      </el-form-item>
      <el-form-item label="性别">
        <el-select v-model="form.gender" placeholder="请选择">
          <el-option label="男" value="1"></el-option>
          <el-option label="女" value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="入职时间">
        <el-date-picker
          v-model="form.daterange"
          type="daterange"
          range-separator="至"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>

    <!-- 按钮区域 -->
    <el-row :gutter="120">
      <el-col :span="2">
        <el-button type="primary">+ 新增员工</el-button>
      </el-col>
      <el-col :span="2">
        <el-button type="primary">- 批量删除</el-button>
      </el-col>
    </el-row>
    <br />

    <!-- 表格区域 -->
    <el-table :data="tableData" stripe border>
      <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
      <el-table-column label="图像" width="180">
        <template slot-scope="scope">
          <img :src="scope.row.image" width="100px" height="70px" />
        </template>
      </el-table-column>
      <el-table-column label="性别">
        <template slot-scope="scope">
          {{ scope.row.gender == 1 ? "男" : "女" }}
        </template>
      </el-table-column>
      <el-table-column prop="job" label="职位" width="180"> </el-table-column>
      <el-table-column prop="entrydate" label="入职日期" width="180">
      </el-table-column>
      <el-table-column prop="updatetime" label="最后操作时间"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="primary"
            @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button
          >
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <br />

    <!-- 分页区域 -->
    <el-pagination
      :page-sizes="[100, 200, 300, 400]"
      :page-size="100"
      layout="total, sizes, prev, pager, next, jumper"
      :total="400"
    >
    </el-pagination>
  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      tableData: [],
      form: {
        user: "",
        region: "",
        daterange: "",
      },
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  mounted() {
    axios
      .get("https://mock.apifox.cn/m1/3128855-0-default/emp/list")
      .then((result) => {
        this.tableData = result.data.data;
      });
  },
};
</script>

<style>
#container {
  border: 1px solid #eee;
}

#head {
  font-size: 40px;
  color: white;
  background-color: #409eff;
}

#aside {
  height: 650px;
  border: 1px solid #eee;
  background-color: #545c64;
}

.menu-class {
  text-decoration: none;
  color: white;
}
</style>